<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TopicSelection extends Model
{
    protected $fillable = [
        'student_id',
        'topic_id',
        'status',
        'apply_time',
        'review_time',
        'feedback',
    ];

    protected $casts = [
        'apply_time' => 'datetime',
        'review_time' => 'datetime',
    ];

    public function student()
    {
        return $this->belongsTo(Student::class);
    }

    public function thesisTopic()
    {
        return $this->belongsTo(ThesisTopic::class, 'topic_id');
    }

    public function taskBook()
    {
        return $this->hasOne(TaskBook::class);
    }

    public function proposalReport()
    {
        return $this->hasOne(ProposalReport::class);
    }

    public function guidanceRecords()
    {
        return $this->hasMany(GuidanceRecord::class);
    }

    public function thesisDocuments()
    {
        return $this->hasMany(ThesisDocument::class);
    }
}